        // 小图边框
        $('.j-white').mouseover(function() {
            $(this).addClass('border-red').siblings().removeClass('border-red');
            // $(this).addClass('j-img').siblings().removeClass('j-img')
            $('.j-min').children('li').addClass('j-img').siblings().removeClass('j-img');
            $('.j-min li').eq($(this).index()).css('z-index', 99).siblings().css('z-index', '0');
        });
        // // hover效果
        // // console.log($('.j-min').children().children())
        // $('.j-min').children().children().mouseover(function() {
        //         console.log(this);
        //     })
        // console.log($('.icon'));
        // 左右滑动
        $('.j-right-jt').click(function() {
            $('.j-he-list').animate({
                left: -65
            }, 600);
            $('.j-left-jt').css('color', 'black');
            $('.j-right-jt').css('color', '#ccc');
        });
        $('.j-left-jt').click(function() {
            $('.j-he-list').animate({
                left: 0
            }, 600);
            $('.j-left-jt').css('color', '#ccc');
            $('.j-right-jt').css('color', 'black');
        });
        $('.j-min').hover(function() {
            $('#j-mask').fadeToggle(100);
            $('.j-max_img').eq($('.border-red').index()).stop().fadeToggle(100);
        })

        $('.j-min').mousemove(function(e) {
            var minX = e.pageX - $('.j-min').offset().left;
            var minY = e.pageY - $('.j-min').offset().top;
            // 光标在蒙版的中间
            minX = minX - $('#j-mask').innerWidth() / 2;
            minY = minY - $('#j-mask').innerHeight() / 2;

            var maskX = $('.j-min').width() - $('#j-mask').width();
            var maskY = $('.j-min').width() - $('#j-mask').width();
            // 蒙版移动的最大距离
            if (minX > maskX) {
                minX = maskX;
            } else if (minX < 0) {
                minX = 0
            };
            if (minY > maskY) {
                minY = maskY;
            } else if (minY < 0) {
                minY = 0
            };
            // 蒙版位置
            $("#j-mask").css({
                left: minX,
                top: minY
            })

            // 比例关系
            // 蒙版移动 大盒图片也移动
            var radioX = minX / maskX;
            var radioY = minY / maskY;
            $(".j-max_img").css({
                left: radioX * ($('#j-max').width() - $('.j-max_img').width()),
                top: radioY * ($('#j-max').height() - $('.j-max_img').height())
            });
            // 蒙版偏移
            $('#j-mask').offset().left = minX + 'px';
            $('#j-mask').offset().left = minY + 'px';
        });
        // 第三行左侧
        $('.mcThree>li').click(function() {
            $(this).addClass('curr').siblings().removeClass('curr')
        });
        // 第三行右侧
        $('.j-g-m-detail-top-left-ul>li').click(function() {
            $(this).addClass('j-g-m-detail-top-left-ul-first').siblings().removeClass('j-g-m-detail-top-left-ul-first')
        });
        $('.j-g-m-detail-top-right-2').click(function() {
            $('.j-middle-goshopping').css({
                "display": "block"
            });
            // if (!this.onclick(this)) {
            //     $('.j-middle-goshopping').css({
            //         "display": "none"
            //     });
            // }
        });


        $('.j-middle-goshopping>p:nth-child(3)>button').click(function() {
            $('.j-middle-goshopping').css({
                "display": "none"
            });
        })
        $('.j-g-m-detail-top4-ul>li').click(function() {
            $(this).addClass('j-g-m-detail-top4-ul-red').siblings().removeClass('j-g-m-detail-top4-ul-red')
        })
        $('.gm-f-tab>a').click(function() {
            $(this).addClass('curr').siblings().removeClass('curr')
        })

        $.getJSON('../mock/homepage.json', function(data) {
            console.log(data[0].homepage[1].goods_thumb.gallery_list);
            console.log(data[0].homepage[0].goods_thumb.gallery_list[1]);
            showPage(data[0].homepage);
            showPage1(data[0].homepage);
            showPage2(data[0].homepage);
            showPage3(data[0].homepage);
            // showPage4(data[0].homepage);
            showPage5(data[0].homepage);
            showPage6(data[0].homepage);
            console.log(data[0].homepage[20].cat_name);
            console.log(data[0].homepage[0].goods_id);
        });

        function showPage(data) {
            var pageDatas = '';
            for (var i = 0; i < data.length; i++) {
                var xiao = ``;
                for (var j = 0; j < data[i].goods_thumb.gallery_list.length; j++) {
                    xiao += `
                    <li class="j-white">
                        <a href="">
                            <img src="${data[i].goods_thumb.gallery_list[j]}" alt="">
                        </a>
                    </li>
                    `
                }
            }
            console.log(xiao);
            $('.j-he-list').html(xiao)
        }

        function showPage1(data) {
            var pageDatas1 = '';
            for (var i = 0; i < data.length; i++) {
                var xiao1 = ``;
                for (var j = 0; j < data[i].goods_thumb.gallery_list.length; j++) {
                    xiao1 = `
                    <a href="" class="label_url"><img src="https://x.dscmall.cn/storage/data/goods/label/双十二2.png"></a>
                <a href="javascript:;" style="cursor: auto;" class="label_url"><img src="https://x.dscmall.cn/storage/data/goods/label/商创精选2.png"></a>
            <span class="j-commodity-details-form-span">${data[i].goods_title}</span>
                    `
                }
            }
            $('.j-commodity-details-form-1').html(xiao1)
        }

        function showPage2(data) {
            var pageDatas2 = '';
            for (var i = 0; i < data.length; i++) {
                var xiao2 = ``;
                for (var j = 0; j < data[i].goods_thumb.gallery_list.length; j++) {
                    xiao2 = `
                    <a href="JavaScript:;" title="${data[i].rz_shop_name}" target="_blank" class="name" id="j-commodity-details-32-name"><span>${data[i].rz_shop_name}</span></a>
                    `
                }
            }
            $('#j-commodity-details-32-name').html(xiao2)
        }

        function showPage3(data) {
            var pageDatas3 = '';
            for (var i = 0; i < data.length; i++) {
                var xiao3 = ``;
                for (var j = 0; j < data[i].goods_thumb.gallery_list.length; j++) {
                    xiao3 = `
                    <h3><span  class="j-detail-hd-fixed-span">${data[i].rz_shop_name}</span></h3>
                    `
                }
            }
            $('.j-detail-hd-fixed-span').html(xiao3)
        }

        // function showPage4(data) {
        //     var pageDatas4 = '';
        //     for (var i = 0; i < data.length; i++) {
        //         var xiao3 = ``;
        //         for (var j = 0; j < data[i].goods_thumb.gallery_list.length; j++) {
        //             xiao4 = `
        //             <div class="j-commodity-details-31">
        //         <a href="https://x.dscmall.cn/merchants_store-10693.html" target="_blank">
        //             <img src="https://x.dscmall.cn/storage/images/1 - 副本.jpg"></a>
        //     </div>
        //             `
        //         }
        //     }
        //     $('.').html(xiao4)
        // }

        function showPage5(data) {
            var pageDatas5 = '';
            for (var i = 0; i < data.length; i++) {
                var xiao5 = ``;
                for (var j = 0; j < data[i].goods_thumb.gallery_list.length; j++) {
                    xiao5 = `
                    <span class="j-crumbs-nav-item-a1"><span>${data[i].cat_name}</span></span>
                    `
                }
            }
            $('.j-crumbs-nav-item-a1').html(xiao5);
        };
        // 商品详情事件
        $('.j-g-m-detail-top-left-ul>li:nth-child(1)').click(function() {
            $('.j-g-m-detail-top2').css("display", "block");
            $('.j-g-m-detail-top3').css("display", "block");
            $('.j-g-m-detail-top0>div:nth-child(3)').css("display", "block");
            $('.Ptable').css("display", "none");
            $('.j-g-m-detail-top4').css("display", "block");
            $('.j-praise-rate-warp').css("display", "block");
            $('.com-list-main').css("display", "block");
            $('.j-g-m-detail-top2>span').text("商品详情");
        });
        $('.j-g-m-detail-top-left-ul>li:nth-child(2)').click(function() {
            $('.j-g-m-detail-top2').css("display", "block");
            $('.j-g-m-detail-top0>div:nth-child(3)').css("display", "none");
            $('.j-g-m-detail-top3').css("display", "none");
            $('.Ptable').css("display", "block");
            $('.j-g-m-detail-top4').css("display", "block");
            $('.j-praise-rate-warp').css("display", "block");
            $('.com-list-main').css("display", "block");
            $('.j-g-m-detail-top2>span').text("规格参数");
        });
        $('.j-g-m-detail-top-left-ul>li:nth-child(3)').click(function() {
            $('.j-g-m-detail-top2').css("display", "none");
            $('.j-g-m-detail-top0>div:nth-child(3)').css("display", "none");
            $('.j-g-m-detail-top3').css("display", "none");
            $('.Ptable').css("display", "none");
            $('.j-g-m-detail-top4').css("display", "block");
            $('.j-praise-rate-warp').css("display", "block");
            $('.com-list-main').css("display", "block");
        });
        $('.j-g-m-detail-top-left-ul>li:nth-child(4)').click(function() {
            $('.j-g-m-detail-top2').css("display", "none");
            $('.j-g-m-detail-top0>div:nth-child(3)').css("display", "none");
            $('.j-g-m-detail-top3').css("display", "none");
            $('.Ptable').css("display", "none");
            $('.j-g-m-detail-top4').css("display", "none");
            $('.j-praise-rate-warp').css("display", "none");
            $('.com-list-main').css("display", "none");
        });
        // ***********************

        // var jmiddlegoshoppingvalue = $('#j-middle-goshopping-value');
        // console.log($('#j-middle-goshopping-value'));
        // jmiddlegoshoppingvalue.onclick = function() {
        //     HTML.offset()
        // }
        // ----------------侧边栏通用(第一个)------------------------
        var liEs = document.querySelectorAll('#quick_links ul li');
        var ibar_login_box = document.querySelector('.ibar_login_box');
        // console.log(liEs);
        liEs[0].onmouseover = function() {
            ibar_login_box.style.display = 'block';
        }
        liEs[0].onmouseout = function() {
                ibar_login_box.style.display = 'none';
            }
            //---------------侧边栏(下面每一项)------------------------
        var onEle = document.querySelectorAll('.ones');
        var mp_tooltip = document.querySelectorAll('.mp_tooltip');
        // console.log(onEle);
        // console.log(mp_tooltip);
        function side() {
            for (var i = 0; i < mp_tooltip.length; i++) {
                mp_tooltip[i].className = 'mp_tooltip';
            }
        };
        for (var j = 0; j < onEle.length; j++) {
            onEle[j].index = j;
            onEle[j].onmouseover = function() {
                side();
                mp_tooltip[this.index].className = 'mp_tooltip ele';
            }
            onEle[j].onmouseout = function() {
                side();
            }
        };
        // ---------------------------侧边栏右侧出现-------------------
        var shopCart = document.querySelector('#shopCart');
        var ibar_closebtn = document.querySelector('.ibar_closebtn');
        var quick_links_wrap = document.querySelector('.quick_links_wrap');
        shopCart.onclick = function() {
            quick_links_wrap.style.width = '320px';
        }
        ibar_closebtn.onclick = function() {
            quick_links_wrap.style.width = '40px';
        }
        $('.returnTop').click(function(e) {
            $("html").animate({
                scrollTop: 0
            }, 1000);
        });

        var mainOffsetTop = $("#brand").offset().top;
        $(window).scroll(function(e) {
            if ($(window).scrollTop() >= mainOffsetTop) {
                $('.returnTop').addClass('show');
            } else {
                $('.returnTop').removeClass('show');
            }
        });
        $(function() {
            $(window).scroll(function() {
                if ($(window).scrollTop() >= 240) {
                    $('.returnTop').addClass('show');

                } else {
                    $('.returnTop').removeClass('show');
                }
            })
        });
        // 本地存储
        function showPage6(data) {
            localStorage.setItem("indexs", data[0].goods_id);
        }